﻿@model QuestionsAnswers.UI.Models.Answer

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Answer</legend>
        @Html.HiddenFor(model=>model.QuestionId)
        @Html.HiddenFor(model=>model.UserId)
      
        <div class="editor-label">
            @Html.LabelFor(model => model.Text)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Text)
            @Html.ValidationMessageFor(model => model.Text)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.User.UserName, "User")
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model=>model.User.UserName)
           
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Question.Text, "Question")
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model=>model.Question.Text)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index",new {id = Model.QuestionId})
</div>
